var mongoose = require('mongoose')

mongoose.connect('mongodb://localhost/itcast')

var Schema = mongoose.Schema

var detailSchema = new Schema({
    store_name: {
        type: String,
        required: true
    },
    store_id: {
        type: String,
        required: true
    },
    goods_type: {
        type: String,
        required: true
    },
    out_in: {
        type: String,
        required: true
    },
    num: {
        type: Number,
        required: true
    }
})

// var sss = mongoose.model('Detail', detailSchema);
// var s1 = new sss({
//     store_name: '长安仓002',
//     store_id: 'ca002',
//     goods_type: '女装/男装',
//     out_in: '出仓',
//     num: 999
// })

// s1.save(function(err) {
//     if (err) {
//         console.log(err)
//     } else {
//         console.log('save success!!')
//     }
// })

module.exports = mongoose.model('Detail', detailSchema)